<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>拖拽</title>
    <style type="text/css">
        body {
            margin: 0;
            height: 100%;
        }

        a {
            position: absolute;
            top: 0;
            left: 0;
            width: 100px;
            height: 100px;
            background-color: green;
        }

       
    </style>
</head>

<body>
    <a href="javascript:;"></a>
    <div></div>
    <script type="text/javascript" src="../common/js/utils.js"></script>
    <script type="text/javascript" src="js/drag.js"></script>
    <script type="text/javascript">
        // onmousedown + onmouseup = click
        var oLink = document.getElementsByTagName('a')[0],
            oMenu = document.getElementsByTagName('div')[0];
        oLink.dragNclick(oMenu, function () {
            window.open('http://www.baidu.com');
        });
    </script>
</body>

</html>